package com.liu.domain.base;

import java.io.Serializable;

/**
 * 响应信息
 *
 * @author LIU
 */
public class BaseResult implements Serializable {
    /**
     * 状态
     */
    private boolean success;

    /**
     * 信息
     */
    private String msg;

    public boolean getSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg == null ? "" : msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public BaseResult() {

    }

    private BaseResult(boolean success) {
        this.success = success;
    }

    private BaseResult(boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }

    public static BaseResult error(String msg) {
        return new BaseResult(false, msg);
    }

    public static BaseResult success() {
        return new BaseResult(true);
    }
}
